<!-- src/components/Modal.vue -->
<template>
  <div
      :style="{ display: show ? 'block' : 'none' }"
      class="modal"
      @click.self="close"
  >
    <div class="modal-content">
      <div class="modal-header">
        <slot name="header"></slot>
        <span class="close" @click="close">&times;</span>
      </div>
      <div class="modal-body">
        <slot name="body"></slot>
      </div>
      <div class="modal-footer">
        <slot name="footer"></slot>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Modal",
  props: {
    show: {
      type: Boolean,
      default: false,
    },
  },
  methods: {
    close() {
      this.$emit("close");
    },
  },
};
</script>

<!-- 在<style>标签中修改路径 -->
<style scoped>
@import "../assets/css/components.css";
</style>
